package sd.settemmezzo.util;

import sd.settemmezzo.common.Player;
import sd.settemmezzo.player.state.GlobalState;
import sd.settemmezzo.player.state.Deck.Carta;

public class Debug {

	public static String printPlayersList(Ring playersList) {
		String lista = "Players List: ";
		for (Player player : playersList) {
			lista += player.getId() + ":" + player.getNamePlayer() + "; ";
		}		
		return lista;
	}

	public static String printGlobalState(GlobalState gstate) {
		String result = "";
		
		for (Player p : gstate.getRing()) {
			String printListaCarte = "Carte " + p.getNamePlayer() + ": ";
			String puntata = "Puntata " + p.getNamePlayer() + ": " + gstate.getPuntata(p.getId())  + " €";
			String punteggio = "Punteggio " + p.getNamePlayer() + ": " + gstate.getPunteggio(p.getId());
			String soldirimanenti = "Soldi " + p.getNamePlayer() + ": " + gstate.getSoldi(p.getId()) + " €";
			
			if (gstate.getCarte(p.getId()) != null) {
				for (Carta c : gstate.getCarte(p.getId())) {
					printListaCarte += c.getImage() + "  ";
				}
			}
			
			result += printListaCarte + "\n";
			result += punteggio + "\n";
			result += puntata + "\n";
			result += soldirimanenti;
			
			if (p != gstate.getRing().lastElement()) 
				result += "\n----\n";
		}
		
		return result;
	}
	
}
